package com.app.entity;

import lombok.Data;
import org.bson.types.ObjectId;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.index.CompoundIndex;
import org.springframework.data.mongodb.core.mapping.Document;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;

/**
 * 推荐商品
 *
 * @autor xiaoyu.fang
 * @date 2019/10/10 10:56
 */
@Data
@Document(collection = "s_recommend")
@CompoundIndex(def = "{'title':1,'dataStatus':1,'createAt':-1}", background = true, name = "s_recommend_index")
public class Recommend implements Serializable{
    @Id
    private ObjectId id;
    /**
     * 标题
     */
    @NotNull(message = "标题不能为空", groups = {Create.class, Update.class})
    private String title;
    /**
     * 图片
     */
    private String image;
    /**
     * 创建时间
     */
    private Date createAt;
    /**
     * 数据状态
     */
    private Integer dataStatus;

    public interface Create{}

    public interface Update{}
}
